<script>
    setTimeout(() => { console.log(1)}, 0)
    new Promise((resolve, reject) => {
        console.log(2)
        // resolve('p1')
        new Promise((resolve, reject) => {
            console.log(3)
            setTimeout(() => {
                resolve('setTimeout2')
                console.log(4)
            }, 0)
            // resolve('p2')
        }).then(data => {
            console.log(data)
        })

        setTimeout(() => {
            resolve('setTimeout1')
            console.log(5)
        }, 0)
    }).then(data => {
        console.log(data)
    })
    console.log(6)
</script>

<!-- <script>
    new Promise((resolve, reject) => {
        resolve(1)
        new Promise((resolve, reject) => {
            resolve(2)
        }).then(data => {
            console.log(data)
        })
    }).then(data => {
        console.log(data)
    })

    console.log(3)
</script> -->

<!-- <script>
    console.log(1)
  
    setTimeout(function() {
      console.log(2)
    }, 0)
  
    const p = new Promise((resolve, reject) => {
      console.log(3)
      resolve(1000) // 标记为成功
      console.log(4)
    })
  
    p.then(data => {
      console.log(data)
    })
  
    console.log(5)
  </script> -->

<!-- <script>
    console.log(1);
    setTimeout(() => {
        console.log(2);
    }, 0)
    console.log(3);
</script>
<script>
    console.log(4);
    setTimeout(() => {
        console.log(5);
    }, 0)
    console.log(6);
</script> -->